<?php

// JsApi
// GET common.jsApi

namespace app\api\resource\common;
use think\Config;
use app\wechat\lib\JsApi as JsApiLogic;

class JsApi
{
    // 方法
    public $_method = ['GET'];
    // 前置
    public $_pre    = [];
    // 描述
    public $_description = 'JsApi';
    // 参数
    public $_param  = [
        'url' => '当前网页的URL，不包含#及其后面部分',
    ];
    // 返回
    public $_return = [
        200 => '获取成功',
        422 => '当前网页的RUL必须',
    ];

    public function run(&$request)
    {
        $url = $request->get('url/s','','trim');

        if ( empty($url) ) return [422,'当前网页的RUL必须'];

        $ret = JsApiLogic::run($url);

        return [200,$ret];
    }
}